/**
 * @author - cozevn.
 * @Date : 01-Dec-2011
 */
package vn.com.tiz.DocumentZ.view;

import vn.com.tiz.DocumentZ.settings.AppSettings;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.view.Gravity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.VideoView;

public class PageView extends FrameLayout {

	//ImageView imgMain
	FrameLayout container;
	
	public PageView(Context context){
		super(context);
		setBackgroundColor(Color.GRAY);
		//setOrientation(LinearLayout.VERTICAL);
		
		//LayoutParams lparam = new LayoutParams(AppSettings.SCREEN_WIDTH,AppSettings.SCREEN_HEIGHT);
		//lparam.gravity = Gravity.CENTER | Gravity.BOTTOM;
		
		
		container = new FrameLayout(this.getContext());
		//LayoutParams lparam1 = new LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.MATCH_PARENT);
		LayoutParams lparam1 = new LayoutParams(440,700);
		lparam1.setMargins(5, 5, 5, 5);
		//lparam1.gravity = Gravity.CENTER | Gravity.CENTER_VERTICAL;
		lparam1.gravity = Gravity.CENTER;
		//container.setp
		container.setLayoutParams(lparam1);
		
		addView(container);
		
		//setLayoutParams(lparam);
		//VideoView video = new VideoView(getContext());
		//container.addView(video);
		
	}
	
	@Override
	protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
		// TODO Auto-generated method stub
		
		super.onMeasure(widthMeasureSpec, heightMeasureSpec);
		setMeasuredDimension(AppSettings.SCREEN_WIDTH,AppSettings.SCREEN_HEIGHT-30);
	}
	
	public void setImage(int resID){
		container.setBackgroundResource(resID);
	}
	
	public void addItem(View v){
		container.addView(v);
	}
	
	public void loadContent(){
		//read xml config
		
	}
	
	@Override
	protected void onDraw(Canvas canvas) {
		// TODO Auto-generated method stub
		super.onDraw(canvas);
	}
}
